home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
util
/
wb
/
huntwin2_1.lha
/
huntwindows.s
< prev
Wrap
Text File
|
1993-03-15
|
26KB
|
1,260 lines
output work:huntwindows
OPT o+,ow-
;no includes - i use them all preassembled!
;.... nearly all ....
incdir "sys:devpac/include/"
include "workbench/startup.i"
include "workbench/workbench.i"
include "libraries/commodities.i"
;WHERE ARE THE INCLUDES FOR THIS??????
_LVOFreeDiskObject = -90
_LVOGetDiskObject = -78
_LVOFindToolType = -96
;Some helpful macros
CALL macro
jsr _LVO\1(a6)
endm
Push macro
movem.l \1,-(sp)
endm
Pull macro
movem.l (sp)+,\1
endm
RSave macro
movem.l a0-a6/d0-d7,-(sp)
endm
RLoad macro
movem.l (sp)+,a0-a6/d0-d7
endm
MaxScreens equ 64 ;Maximum of 64 Screens - who has more?
ScreenMemSize equ MaxScreens*8
;Bits for Communication
SignalWindow equ 0
SignalScreen equ 1
move.l $04,a6
move.l #AllocLength,d0
move.l #MEMF_CLEAR,d1
CALL AllocMem
move.l d0,a4
beq EndeRaus
move.l d0,RememberA4
lea DosName(pc),a1
moveq.l #36,d0 ;2.0 Only
CALL OpenLibrary
move.l d0,DosBase(a4)
beq Error2
lea GadName(pc),a1
moveq.l #0,d0
CALL OpenLibrary
move.l d0,GadBase(a4)
beq Error2
lea CommName(pc),a1
moveq.l #0,d0
CALL OpenLibrary
move.l d0,CommBase(a4)
beq Error2
move.l ThisTask(a6),a1
tst.l pr_CLI(a1)
bne CliStart
lea pr_MsgPort(a1),a2
move.l a2,a0
CALL WaitPort
move.l a2,a0
CALL GetMsg
move.l d0,WBMessage(a4)
move.l d0,a3
move.l $04,a6
lea IconName(pc),a1
moveq.l #33,d0
CALL OpenLibrary
move.l d0,IconBase(a4)
beq Error2
move.l sm_ArgList(a3),d0
beq.s SkipReadArgs
move.l d0,a0
move.l a0,-(sp)
move.l wa_Lock(a0),d1
move.l DosBase(a4),a6
CALL CurrentDir
move.l (sp)+,a0
move.l IconBase(a4),a6
move.l wa_Name(a0),a0
CALL GetDiskObject
move.l d0,DObject(a4)
beq Error2
move.l #SIGBREAKF_CTRL_C,SignalMask(a4)
lea WBTemplate(pc),a3
move.l d0,a0
move.l do_ToolTypes(a0),a0
GetEmLoop move.l (a3)+,a1
move.l a1,d0
beq.s FreeDobj
move.l a0,-(sp)
CALL FindToolType
move.l (sp)+,a0
move.l (a3)+,a2
add.l a4,a2
move.l d0,(a2)
bra.s GetEmLoop
FreeDobj move.l DObject(a4),a0
CALL FreeDiskObject
bra.s SkipReadArgs
CliStart move.l DosBase(a4),a6
move.l #Template,d1
lea TemplateArray(a4),a0
move.l a0,d2
moveq.l #0,d3
CALL ReadArgs ;Get options
tst.l d0
beq Error3
move.l d0,Args(a4)
SkipReadArgs move.l $04,a6
lea intuition(pc),a1
moveq.l #36,d0
CALL OpenLibrary
move.l d0,IntBase(a4)
beq Error2
lea GraphicsName(pc),a1
moveq.l #36,d0
CALL OpenLibrary
move.l d0,GraphicsBase(a4)
beq Error2
tst.l TempHADJ(a4)
beq GotIt1
move.l TempHADJ(a4),a0
bsr GetNexta0
clr.l TempHADJ(a4)
cmp.b #"l",d0
beq.s GotIt1
add.l #1,TempHADJ(a4)
cmp.b #"r",d0
beq.s GotIt1
add.l #1,TempHADJ(a4)
cmp.b #"c",d0
beq.s GotIt1
add.l #1,TempHADJ(a4)
GotIt1 tst.l TempVADJ(a4)
beq GotIt2
move.l TempVADJ(a4),a0
bsr GetNexta0
clr.l TempVADJ(a4)
cmp.b #"t",d0
beq.s GotIt2
add.l #1,TempVADJ(a4)
cmp.b #"b",d0
beq.s GotIt2
add.l #1,TempVADJ(a4)
cmp.b #"c",d0
beq.s GotIt2
add.l #1,TempVADJ(a4)
GotIt2 move.l $04,a6
CALL CreateMsgPort
move.l d0,BrokerPort
move.l d0,MyPort(a4)
move.l d0,a0
move.b MP_SIGBIT(a0),d0
move.l SignalMask(a4),d1 ;Enter signal into
bset d0,d1 ;mask for waiting
move.l d1,SignalMask(a4)
move.l CommBase(a4),a6
lea MyNewBroker(pc),a0
clr.l d0
CALL CxBroker
tst.l d0
beq QuitPrg
move.l d0,Broker(a4)
move.l d0,a0
moveq.l #1,d0
CALL ActivateCxObj
move.l $04,a6 ;Build interrupt-server
sub.l a1,a1
jsr _LVOFindTask(a6)
move.l d0,OwnTask(a4)
moveq #-1,d0 ;A Signal for telling
jsr _LVOAllocSignal(a6) ;our task that sth happened
tst.l d0
bmi Error2
move.l d0,Signal(a4)
move.l SignalMask(a4),d1
bset d0,d1
move.l d1,SignalMask(a4)
lea MyInterrupt(a4),a1
move.l #Interrupt3,IS_CODE(a1)
clr.l IS_DATA(a1)
move.b #NT_INTERRUPT,LN_TYPE(a1)
move.b #0,LN_PRI(a1)
move.l #HandlerName,LN_NAME(a1)
move.l #5,d0 ;INTB_VERTB
jsr _LVOAddIntServer(a6)
WaitOn tst.w QuitMe(a4)
bne QuitPrg
tst.l TempCXPOPUP(a4)
beq.s NoPop
bsr OpenGUI
clr.l TempCXPOPUP(a4)
NoPop move.l $04,a6
move.l SignalMask(a4),d0 ;Wait for Port and Break
CALL Wait
btst #SIGBREAKB_CTRL_C,d0 ;This means quit
bne QuitPrg
move.l Signal(a4),d1
btst d1,d0 ;Signal from Interrupt?
beq.s TryNextMsg
tst.w DisableHW(a4)
bne.s TryNextMsg ;Do nothing
move.l IntBase(a4),a0
btst #SignalWindow,What(a4)
beq.s NoWindowStuff
move.l ib_ActiveWindow(a0),a0
bsr DoYourJob
bclr #SignalWindow,What(a4)
NoWindowStuff btst #SignalScreen,What(a4)
beq.s TryNextMsg
move.l IntBase(a4),a0
move.l ib_FirstScreen(a0),a0
bsr AdjustScreen
bclr #SignalScreen,What(a4)
TryNextMsg move.l MyPort(a4),a0 ;Get the message awaiting
CALL GetMsg
tst.l d0
bne.s GotMsg
bsr CheckGUI
bra WaitOn
GotMsg move.l d0,a3
move.l d0,a0
move.l CommBase(a4),a6
CALL CxMsgType
move.l d0,d6
move.l a3,a0
CALL CxMsgID
move.l d0,d5
move.l a3,a1
move.l $04,a6
CALL ReplyMsg
cmp.w #CXM_IEVENT,d6
bne.s OtherCommand
bsr OpenGUI
OtherCommand cmp.w #CXM_COMMAND,d6
bne WaitOn
cmp.w #CXCMD_DISABLE,d5
bne.s OtherI1
move.w #1,DisableHW(a4)
OtherI1 cmp.w #CXCMD_ENABLE,d5
bne.s OtherI2
clr.w DisableHW(a4)
OtherI2 cmp.w #CXCMD_UNIQUE,d5
beq.s OtherII
cmp.w #CXCMD_APPEAR,d5
bne.s OtherI3
OtherII bsr OpenGUI
OtherI3 cmp.w #CXCMD_DISAPPEAR,d5
bne.s OtherI4
bsr CloseGUI
OtherI4 cmp.w #CXCMD_KILL,d5
beq QuitPrg
bra TryNextMsg
Error3 lea Text1(pc),a0 ;Seems there is an error
bsr PrintText ;in the given arguments
bra.s QuitPrg
Error2 lea Text2(pc),a0 ;Tell the user something
bsr PrintText ;went wrong with the libs
bra.s QuitPrg
QuitPrg bsr CloseGUI
move.l $04,a6
move.l #5,d0
lea MyInterrupt(a4),a1
tst.l IS_CODE(a1)
beq.s NoHandler
CALL RemIntServer ;Remove the Interrupt-Server
NoHandler move.l Signal(a4),d0 ;Free the signal
beq.s DontFreeS
CALL FreeSignal
DontFreeS tst.l Args(a4)
beq.s HmmNoArgs
move.l DosBase(a4),a6
move.l Args(a4),d1
CALL FreeArgs
HmmNoArgs tst.l Broker(a4)
beq.s NoCX
move.l CommBase(a4),a6
move.l Broker(a4),a0
CALL DeleteCxObjAll
NoCX move.l $04,a6
tst.l MyPort(a4)
beq.s NoPort
ReplyAllLeft move.l MyPort(a4),a0
CALL GetMsg
tst.l d0
beq.s NoMsgLeft
move.l d0,a1
CALL ReplyMsg
bra.s ReplyAllLeft
NoMsgLeft move.l MyPort(a4),a0
CALL DeleteMsgPort ;and free it
NoPort tst.l IntBase(a4) ;Close librarys
beq.s ErrorX2
move.l IntBase(a4),a1
CALL CloseLibrary
ErrorX2 tst.l GraphicsBase(a4)
beq.s Error
move.l GraphicsBase(a4),a1
CALL CloseLibrary
Error move.l $0004.w,a6
tst.l WBMessage(a4)
beq.s NoWB
move.l WBMessage(a4),a1
CALL ReplyMsg
NoWB move.l $04,a6
move.l IconBase(a4),d0
beq.s NoIconLib
move.l d0,a1
CALL CloseLibrary
NoIconLib tst.l CommBase(a4)
beq.s NoCommLib
move.l CommBase(a4),a1
CALL CloseLibrary
NoCommLib tst.l GadBase(a4)
beq.s OnlyDOS
move.l GadBase(a4),a1
CALL CloseLibrary
OnlyDOS tst.l DosBase(a4)
beq.s FreeOnly
move.l DosBase(a4),a1
CALL CloseLibrary
FreeOnly move.l a4,a1
move.l #AllocLength,d0
CALL FreeMem
EndeRaus moveq.l #0,d0
rts
;Subroutine to print a text to stdout
PrintText Push d0-d4/a0-a1/a6
move.l a0,a1
moveq.l #0,d0
TestLen tst.b (a1)+
beq.s LaengeOk
addq #1,d0
bra.s TestLen
LaengeOk move.l DosBase(a4),a6
move.l a0,d2
move.l d0,d3
CALL Output
move.l d0,d1
beq.s SkipWrite
move.l a0,d2
move.l d0,d3
CALL Write
SkipWrite Pull d0-d4/a0-a1/a6
rts
;MainPart: does the scrolling if necessary
;Gets window in a0
DoYourJob RSave
move.l a0,d0 ;No Window - let it be!
beq LeaveIt
move.l a0,a5
move.l wd_WScreen(a5),a0
;cmp.l FirstSc(a4),a0
;bne.s NoInterest
move.l a5,d0
bsr RememberWindow
NoInterest move.l a0,d0 ;Screen not valid? - let it be!
beq LeaveIt
move.l a0,a3
tst.l TempWBOnly(a4) ;Only work on WBench Screen?
beq.s NoMatter
move.w sc_Flags(a3),d0
and.w #$f,d0
cmp.w #WBENCHSCREEN,d0
bne LeaveIt
NoMatter move.l GraphicsBase(a4),a6 ;Get the visible size
lea sc_ViewPort(a3),a0 ;of the screen to
CALL GetVPModeID ;determine when a window
move.l d0,d2 ;is visible and when not
lea DisplayInfer(a4),a1
move.l #dim_SIZEOF,d0
move.l #DTAG_DIMS,d1
sub.l a0,a0
CALL GetDisplayInfoData
lea DisplayInfer(a4),a0
lea dim_TxtOScan(a0),a0
move.w ra_MaxX(a0),d0
sub.w ra_MinX(a0),d0
addq #1,d0
move.w d0,VisualX(a4)
move.w ra_MaxY(a0),d0
sub.w ra_MinY(a0),d0
addq #1,d0
move.w d0,VisualY(a4)
move.l a3,a0
move.l IntBase(a4),a6
tst.l TempSFront(a4) ;do we want screentofront?
beq.s NoFront
CALL ScreenToFront
bset #SignalScreen,What(a4) ;ScreenChange!
NoFront move.l wd_Flags(a5),d0
and.l #WFLG_BACKDROP,d0
bne LeaveIt ;Not with backdrops!
tst.l TempWFront(a4) ;do we WindowToFront() ?
beq.s NoFront2
move.l a5,a0
move.l wd_Flags(a0),d0
and.l #WBENCHWINDOW,d0 ;does not work - but why?
bne.s NoFront2
CALL WindowToFront
NoFront2 tst.l TempMove(a4)
beq LeaveIt
move.l wd_WScreen(a5),a0 ;If the screen is smaller
move.w sc_Width(a0),d0 ;that the visible size
cmp.w VisualX(a4),d0 ;in any way, we use the
bcc.s NoMat1 ;original screen-size
move.w sc_Width(a0),VisualX(a4)
NoMat1 move.w sc_Height(a0),d0
cmp.w VisualY(a4),d0
bcc.s NoMat2
move.w sc_Height(a0),VisualX(a4)
NoMat2 moveq.l #0,d7
moveq.l #0,d6
moveq.l #0,d0
moveq.l #0,d2
move.w wd_LeftEdge(a5),d0
add.w wd_Width(a5),d0
move.w sc_LeftEdge(a0),d2
neg.w d2
add.w VisualX(a4),d2
sub.w d0,d2
beq.s SeemsOk2
bpl.s SeemsOk
move.w d2,d7 ;MOVEX!
ext.l d7
SeemsOk move.w wd_LeftEdge(a5),d0
move.w sc_LeftEdge(a0),d2
neg.w d2
sub.w d2,d0
bne.s TestAgain
moveq.l #0,d7
TestAgain bpl.s SeemsOk2
move.w d0,d7 ;MOVEX! - Prefer Leftedge
ext.l d7
neg.l d7
SeemsOk2 move.w wd_TopEdge(a5),d0
move.w sc_TopEdge(a0),d2
neg.w d2
sub.w d2,d0
beq.s SeemsOk4
bpl.s SeemsOk3
move.w d0,d6
ext.l d6 ;MOVEY!
neg.l d6
SeemsOk3 move.w wd_TopEdge(a5),d0
add.w wd_Height(a5),d0
move.w sc_TopEdge(a0),d2
neg.w d2
add.w VisualY(a4),d2
sub.w d0,d2
bne.s TestAgain2
moveq.l #0,d6
TestAgain2 bpl.s SeemsOk4
move.w d2,d6 ;MOVEY! - Prefer bottom
ext.l d6
SeemsOk4 tst.l TempAlways(a4)
bne.s DOOO
tst.l d7
bne.s DOOO
tst.l d6
beq LeaveIt
DOOO move.l d7,d0
tst.l TempAlways(a4)
bne.s DoAlways1
tst.l d0
beq.s NoMoveAny1
DoAlways1 cmp.l #2,TempHADJ(a4)
bne.s NoCentering1
moveq.l #0,d0
move.w wd_Width(a5),d0
lsr.w #1,d0
add.w wd_LeftEdge(a5),d0
moveq.l #0,d2
move.w VisualX(a4),d2
lsr.w #1,d2
move.w sc_LeftEdge(a0),d3
neg.w d3
add.w d3,d2
sub.w d0,d2
move.l d2,d0
ext.l d0
bra NoMoveAny1
NoCentering1 tst.l TempHADJ(a4)
bne.s RightAdj
moveq.l #0,d0
move.w wd_LeftEdge(a5),d0
add.w sc_LeftEdge(a0),d0
neg.w d0
ext.l d0
bra.s NoMoveAny1
RightAdj cmp.l #1,TempHADJ(a4)
bne.s NoMoveAny1
move.w wd_LeftEdge(a5),d0
add.w wd_Width(a5),d0
move.w sc_LeftEdge(a0),d2
neg.w d2
add.w VisualX(a4),d2
sub.w d0,d2
move.l d2,d0
ext.l d0
NoMoveAny1 move.l d6,d1
tst.l TempAlways(a4)
bne.s DoAlways2
tst.l d1
beq.s NoMoveAny2
DoAlways2 cmp.l #2,TempVADJ(a4)
bne.s NoCentering2
moveq.l #0,d1
move.w wd_Height(a5),d1
lsr.w #1,d1
add.w wd_TopEdge(a5),d1
moveq.l #0,d2
move.w VisualY(a4),d2
lsr.w #1,d2
move.w sc_TopEdge(a0),d3
neg.w d3
add.w d3,d2
sub.w d1,d2
move.l d2,d1
ext.l d1
bra NoMoveAny2
NoCentering2 tst.l TempVADJ(a4)
bne.s BotAdj
moveq.l #0,d1
move.w wd_TopEdge(a5),d1
add.w sc_TopEdge(a0),d1
neg.w d1
ext.l d1
bra.s NoMoveAny2
BotAdj cmp.l #1,TempVADJ(a4)
bne.s NoMoveAny2
move.w wd_TopEdge(a5),d1
add.w wd_Height(a5),d1
move.w sc_TopEdge(a0),d2
neg.w d2
add.w VisualY(a4),d2
sub.w d1,d2
move.l d2,d1
ext.l d1
NoMoveAny2 CALL MoveScreen
LeaveIt RLoad
rts
;ScreenID in a0
AdjustScreen RSave
tst.l TempPDef(a4) ;Enter FirstScreen as Default
;PublicScreen ?
beq.s Skip_NoPub
bsr GetPubFromID
move.l a0,d0
beq.s Skip_NoPub
move.l IntBase(a4),a6
CALL SetDefaultPubScreen
Skip_NoPub tst.l TempRemWin(a4) ;Activate a Window on the new
;Screen?
beq.s SkipActive
bsr GetScreenWindow
tst.l d0
beq.s SkipActive
move.l d0,a0
move.l IntBase(a4),a6
CALL ActivateWindow
SkipActive RLoad
rts
;a0=Screen Back:d0=Window
GetScreenWindow Push a1/d1
lea ScreenMem(a4),a1
move.w #MaxScreens-1,d1
ScreenFindLoop cmp.l (a1),a0
beq.s FoundScreen
lea 8(a1),a1
dbf d1,ScreenFindLoop
FoundScreen move.l 4(a1),d0
bsr TestWindowOnScreen
Pull a1/d1
rts
;a0=Screen d0=Window
RememberWindow Push a1-a3/a6/d1
move.l IntBase(a4),a6
lea ScreenMem(a4),a1
move.w #MaxScreens-1,d1
ScreenFindLoop2 tst.l (a1)
beq.s FoundEmpty
move.l (a1),a2
cmp.l a0,a2
beq.s FoundEmpty ;because Identical
move.l ib_FirstScreen(a6),a3
CheckAllScreens cmp.l a3,a2
beq ScreenValid
move.l sc_NextScreen(a3),a3
cmp.l #0,a3
bne.s CheckAllScreens
bra.s FoundEmpty ;because Entry is invalid
ScreenValid lea 8(a1),a1
dbf d1,ScreenFindLoop2
;Reaching this Point our List is full of valid
;Screens - not the best thing, but we simply ignore...
bra.s IgnoreOver
FoundEmpty move.l a0,(a1)
move.l d0,4(a1)
IgnoreOver Pull a1-a3/a6/d1
rts
;d0=Window , a0=Screen =Back: d0=0 no window
TestWindowOnScreen tst.l d0
beq.s NotWindow
move.l sc_FirstWindow(a0),a1
WindowListOn cmp.l d0,a1
beq.s WindowIsOK
move.l wd_NextWindow(a1),a1
cmp.l #0,a1
bne.s WindowListOn
NotWindow clr.l d0
rts
WindowIsOK move.l a1,d0
rts
;ScreenID in a0 ;Return a0=PubScreenName or Zero
GetPubFromID Push d0/a3/a6
move.l a0,a3
move.l IntBase(a4),a6
CALL LockPubScreenList
CarryListOn move.l d0,a0
cmp.l psn_Screen(a0),a3
beq.s ScreenFound
move.l LN_SUCC(a0),d0
bne.s CarryListOn
sub.l a0,a0
bra.s ENDPS
ScreenFound move.l LN_NAME(a0),a0
ENDPS move.l a0,-(sp)
CALL UnlockPubScreenList
move.l (sp)+,a0
Pull d0/a3/a6
rts
Interrupt3 RSave
move.l RememberA4,a4
move.l IntBase(a4),a0
move.l Active(a4),d0
cmp.l ib_ActiveWindow(a0),d0 ;New ActiveWindow?
beq.s DoNothing
move.l ib_ActiveWindow(a0),Active(a4)
bsr SignalMyself
bset #SignalWindow,What(a4)
DoNothing move.l IntBase(a4),a0
move.l FirstSc(a4),d0
cmp.l ib_FirstScreen(a0),d0 ;New FirstScreen?
beq.s DoNothing2
move.l ib_FirstScreen(a0),FirstSc(a4)
bsr SignalMyself
bset #SignalScreen,What(a4)
DoNothing2 RLoad
moveq.l #0,d0
rts
SignalMyself move.l $04,a6
move.l OwnTask(a4),a1
move.l Signal(a4),d1 ;send a signal to move Screen
moveq.l #0,d0
bset d1,d0
CALL Signal
rts
OpenGUI RSave
tst.w GUIOpened(a4)
bne OpenNoGUI
move.l IntBase(a4),a6
sub.l a0,a0
CALL LockPubScreen
move.l d0,PublicScreen(a4)
move.l d0,StorePublicScreen
move.l d0,a0
lea sc_RastPort(a0),a1
move.l a1,PublicRastport(a4)
lea TagList(pc),a1
move.l GadBase(a4),a6
CALL GetVisualInfoA
move.l d0,MyVisual(a4)
lea MyNewGadget(a4),a3
move.l d0,gng_VisualInfo(a3)
lea GadgetList(a4),a0
CALL CreateContext
move.l d0,Gadget0(a4)
move.l GraphicsBase(a4),a6
move.l PublicRastport(a4),a1
lea GUI_Text7(pc),a0
moveq.l #GUI_Text9-GUI_Text8-1,d0
CALL TextLength
move.w d0,RemLen(a4)
move.l PublicRastport(a4),a1
lea GUI_Text9(pc),a0
moveq.l #GUI_Text11-GUI_Text10-1,d0
CALL TextLength
add.w #16,d0
move.w d0,RemLen2(a4)
move.l PublicRastport(a4),a1
lea GUI_Text5(pc),a0
moveq.l #GUI_Text6-GUI_Text5-1,d0
CALL TextLength
move.l d0,d5 ;TextLen
add #54,d0
add.w RemLen(a4),d0
move.l d0,StoreInnerWidth
move.l PublicScreen(a4),a0
moveq.l #6,d0
add.b sc_WBorLeft(a0),d0
add.w d0,d5 ;+ Border/Constant
add.w #42,d5
move.w d0,gng_LeftEdge(a3)
move.w #26,gng_Width(a3)
move.l sc_Font(a0),a1
move.l a1,gng_TextAttr(a3)
moveq.l #1,d0
add.b sc_WBorTop(a0),d0
move.w ta_YSize(a1),d6
add.w #6,d6
move.w d0,gng_TopEdge(a3)
move.w ta_YSize(a1),d0
move.w d0,RemFontSize(a4)
move.l d0,d1
mulu #7,d1
add #46,d1
move.l d1,StoreInnerHeight
addq.l #6,d0
move.w d0,gng_Height(a3)
move.l #PLACETEXT_RIGHT,gng_Flags(a3)
move.w #00,gng_GadgetID(a3)
move.l Gadget0(a4),a5
lea GUI_Text1(pc),a2
move.l GadBase(a4),a6
move.w #6,d4 ;Loop
PlaceGadgets move.l a2,gng_GadgetText(a3)
NextStringEnd tst.b (a2)+
bne.s NextStringEnd
lea TemplateArray(a4),a0
move.w gng_GadgetID(a3),d0
lsl.w #2,d0
move.l (a0,d0.w),CheckedPlace
add.w #1,gng_GadgetID(a3)
add.w d6,gng_TopEdge(a3)
Push a2
moveq.l #CHECKBOX_KIND,d0
move.l a5,a0 ;Previous
move.l a3,a1
lea GadgetTagList(pc),a2
CALL CreateGadgetA
move.l d0,a5
Pull a2
dbf d4,PlaceGadgets
move.w gng_TopEdge(a3),RemEdge(a4)
lea CycleList(pc),a0
move.l a0,CycleStore
move.w d5,gng_LeftEdge(a3)
move.w RemLen(a4),d0
move.w d0,gng_Width(a3)
move.l PublicScreen(a4),a0
moveq.l #1,d0
add.b sc_WBorTop(a0),d0
lsl.w #1,d6
move.w d0,gng_TopEdge(a3)
move.l #PLACETEXT_ABOVE,gng_Flags(a3)
move.w #1,d4
CycleLoop add.w #1,gng_GadgetID(a3)
move.l a2,gng_GadgetText(a3)
NextStringEnd2 tst.b (a2)+
bne.s NextStringEnd2
add.w d6,gng_TopEdge(a3)
lea TemplateArray(a4),a0
move.w gng_GadgetID(a3),d0
lsl.w #2,d0
move.l (a0,d0.w),CycleActive
Push a2
moveq.l #CYCLE_KIND,d0
move.l a5,a0 ;Previous
move.l a3,a1
lea CycleTagList(pc),a2
CALL CreateGadgetA
move.l d0,a5
Pull a2
move.w RemFontSize(a4),d0
add.w d0,gng_TopEdge(a3)
add.l #5*4,CycleStore
dbf d4,CycleLoop
move.l #GUI_Text10,gng_GadgetText(a3)
add.w #1,gng_GadgetID(a3)
move.l #0,gng_Flags(a3)
sub.w #4,RemEdge(a4)
move.w RemEdge(a4),gng_TopEdge(a3)
move.w RemLen2(a4),gng_Width(a3)
Push a2
moveq.l #BUTTON_KIND,d0
move.l a5,a0 ;Previous
move.l a3,a1
lea TagList(pc),a2
CALL CreateGadgetA
move.l d0,a5
Pull a2
move.l #GUI_Text11,gng_GadgetText(a3)
add.w #1,gng_GadgetID(a3)
move.w RemEdge(a4),gng_TopEdge(a3)
move.w RemLen2(a4),gng_Width(a3)
move.l StoreInnerWidth,d0
sub.w RemLen2(a4),d0
sub.w #3,d0
move.w d0,gng_LeftEdge(a3)
Push a2
moveq.l #BUTTON_KIND,d0
move.l a5,a0 ;Previous
move.l a3,a1
lea TagList(pc),a2
CALL CreateGadgetA
move.l d0,a5
Pull a2
move.l a5,LastGadget(a4)
sub.l a0,a0
lea WindowTagList(pc),a1
move.l IntBase(a4),a6
CALL OpenWindowTagList
move.l d0,MyWindow(a4)
beq FailWindow
move.l d0,a0
bsr EnterSignal
;move.l d0,a0
move.l GadgetList(a4),a1
moveq.l #-1,d0
moveq.l #-1,d1
sub.l a2,a2
CALL AddGList
move.l GadgetList(a4),a0
move.l MyWindow(a4),a1
moveq.l #-1,d0
sub.l a2,a2
CALL RefreshGList
move.l GadBase(a4),a6
move.l MyWindow(a4),a0
sub.l a1,a1
CALL GT_RefreshWindow
move.w #1,GUIOpened(a4)
RLoad
rts
OpenNoGUI move.l IntBase(a4),a6
move.l MyWindow(a4),a0
CALL ActivateWindow
RLoad
rts
CheckGUI RSave
tst.w GUIOpened(a4)
beq NoGUI
move.l GadBase(a4),a6
move.l MyWindow(a4),a0
move.l wd_UserPort(a0),a0
CALL GT_GetIMsg
tst.l d0
beq NoGUI
move.l d0,a1
moveq.l #0,d6
move.w im_Code(a1),d6 ;Value of Gadget
move.l im_IAddress(a1),a2
move.l im_Class(a1),d7
CALL GT_ReplyIMsg
cmp.l #GADGETUP,d7
bne.s Others
move.w gg_GadgetID(a2),d0
cmp.w #10,d0
beq HideGad
cmp.w #11,d0
beq QuitGad
cmp.w #8,d0
bcc.s OtherGui
subq #1,d0
bmi.s NoGUI
OtherGui cmp.w #10,d0
bcc.s OtherGui
lsl.w #2,d0
lea TemplateArray(a4),a0
move.l d6,(a0,d0.w)
bra.s NoGUI
QuitGad bsr CloseGUI
move.w #1,QuitMe(a4)
bra.s HideGad
Others cmp.l #CLOSEWINDOW,d7
bne.s NoGUI
HideGad bsr CloseGUI
NoGUI RLoad
rts
CloseGUI RSave
tst.w GUIOpened(a4)
beq.s NotOpened
move.l IntBase(a4),a6
move.l MyWindow(a4),a0
bsr RemoveSignal
;move.l MyWindow(a4),a0
move.l GadgetList(a4),a1
moveq.l #-1,d0
CALL RemoveGList
move.l MyWindow(a4),a0
CALL CloseWindow
FailWindow move.l GadgetList(a4),a0
move.l GadBase(a4),a6
CALL FreeGadgets
move.l MyVisual(a4),a0
CALL FreeVisualInfo
move.l IntBase(a4),a6
sub.l a0,a0
move.l PublicScreen(a4),a1
CALL UnlockPubScreen
NotOpened clr.w GUIOpened(a4)
RLoad
rts
EnterSignal Push d0-d1/a0
move.l wd_UserPort(a0),a0
move.b MP_SIGBIT(a0),d0
moveq.l #1,d1
lsl.l d0,d1
or.l d1,SignalMask(a4)
Pull d0-d1/a0
rts
RemoveSignal Push d0-d1/a0
move.l wd_UserPort(a0),a0
move.b MP_SIGBIT(a0),d0
moveq.l #1,d1
lsl.l d0,d1
eor.l #$ffffffff,d1
and.l d1,SignalMask(a4)
Pull d0-d1/a0
rts
GetNexta0 move.b (a0)+,d0
cmp.b #"=",d0
beq.s GetNexta0
cmp.b #" ",d0
beq.s GetNexta0
or.w #$20,d0
rts
CycleTagList dc.l GTCY_Labels
CycleStore dc.l 0
dc.l GTCY_Active
CycleActive dc.l 0
dc.l TAG_DONE
GadgetTagList dc.l GTCB_Checked
CheckedPlace dc.l 0
TagList dc.l TAG_DONE
WindowTagList dc.l WA_InnerWidth
StoreInnerWidth dc.l 0
dc.l WA_InnerHeight
StoreInnerHeight dc.l 0
dc.l WA_IDCMP
dc.l BUTTONIDCMP!CLOSEWINDOW
dc.l WA_Flags
dc.l WINDOWCLOSE!WINDOWDRAG!WINDOWDEPTH!ACTIVATE
dc.l WA_PubScreen
StorePublicScreen dc.l 0
dc.l WA_Title
dc.l Texth
dc.l WA_AutoAdjust
dc.l 1
dc.l TAG_DONE
RememberA4 dc.l 0
rsreset
DisplayInfer rs.b dim_SIZEOF
GadgetList rs.l 1
What rs.w 1
DisableHW rs.w 1
GUIOpened rs.w 1
QuitMe rs.w 1
RemFontSize rs.w 1
GadgetInside rs.w 11
MyPort rs.l 1
MyVisual rs.l 1
Broker rs.l 1
ScreenMem rs.b ScreenMemSize
IntBase rs.l 1
RemLen rs.w 1
RemLen2 rs.w 1
RemEdge rs.w 1
GadBase rs.l 1
DosBase rs.l 1
CommBase rs.l 1
IconBase rs.l 1
DObject rs.l 1
Active rs.l 1
FirstSc rs.l 1
GraphicsBase rs.l 1
PublicScreen rs.l 1
PublicRastport rs.l 1
Gadget0 rs.l 1
VisualX rs.w 1
VisualY rs.w 1
TemplateArray rs.l 0 ;Do not change order!
TempMove rs.l 1
TempSFront rs.l 1
TempWFront rs.l 1
TempWBOnly rs.l 1
TempPDef rs.l 1
TempAlways rs.l 1
TempRemWin rs.l 1
TempCXPOPUP rs.l 1
TempHADJ rs.l 1
TempVADJ rs.l 1
OwnTask rs.l 1
Signal rs.l 1
Args rs.l 1
WBMessage rs.l 1
SignalMask rs.l 1
MyWindow rs.l 1
LastGadget rs.l 1
MyNewGadget rs.b gng_SIZEOF
MyInterrupt rs.b IS_SIZE
AllocLength rs.w 1
intuition dc.b "intuition.library",0
DosName dc.b "dos.library",0
GraphicsName dc.b "graphics.library",0
IconName dc.b "icon.library",0
GadName dc.b "gadtools.library",0
CommName dc.b "commodities.library",0
even
MyNewBroker dc.b NB_VERSION ;Version
dc.b 0 ;Reserve1
dc.l HandlerName ;Name
dc.l PortName ;Title
dc.l DescText ;Description
dc.w NBU_NOTIFY!NBU_UNIQUE ;Unique
dc.w COF_SHOW_HIDE ;Flags
dc.b 0 ;Pri
dc.b 0 ;Reserve2
BrokerPort dc.l 0 ;Port
dc.w 0 ;ReservedChannel
CycleList dc.l GUI_Choose1.1,GUI_Choose1.2,GUI_Choose1.3,GUI_Choose1.4,0
CycleList2 dc.l GUI_Choose2.1,GUI_Choose2.2,GUI_Choose2.3,GUI_Choose2.4,0
WBTemplate dc.l TextMove,TempMove
dc.l TextSFront,TempSFront
dc.l TextWFront,TempWFront
dc.l TextWBOnly,TempWBOnly
dc.l TextPDef,TempPDef
dc.l TextAlways,TempAlways
dc.l TextCXPOPUP,TempCXPOPUP
dc.l TextHADJ,TempHADJ
dc.l TextVADJ,TempVADJ
dc.l TextRemWin,TempRemWin
dc.l 0
TextMove dc.b "MOVE",0
TextSFront dc.b "SFRONT",0
TextWFront dc.b "WFRONT",0
TextWBOnly dc.b "WBONLY",0
TextPDef dc.b "DEFPUB",0
TextAlways dc.b "ALWAYS",0
TextCXPOPUP dc.b "CX_POPUP",0
TextHADJ dc.b "HADJ",0
TextVADJ dc.b "VADJ",0
TextRemWin dc.b "REMWIN",0
Template dc.b "MOVE/S,SFRONT/S,WFRONT/S,WBONLY/S,DEFPUB/S,ALWAYS/S,CX_POPUP/S,HADJ/K,VADJ/K,REMWIN/S",0
PortName dc.b "Huntwindows 2.1",0
HandlerName dc.b "Huntwindows",0
Text1 dc.b "Error in arguments!",$0a,0
Text2 dc.b "Error opening V36+ librarys!",$0a,0
dc.b "$VER: " ;for version information
Texth dc.b "Huntwindows 2.1 (15.3.93) by Jörg Bublath",0
DescText dc.b "Moves screen to show windows",0
GUI_Text1 dc.b "Move Screen",0
GUI_Text2 dc.b "ScreenToFront",0
GUI_Text3 dc.b "WindowToFront",0
GUI_Text4 dc.b "Workbench only",0
GUI_Text5 dc.b "Set Default PubScreen",0
GUI_Text6 dc.b "Always",0
GUI_Text7 dc.b "Remember Window",0
GUI_Text8 dc.b "Horizontal Adjustment",0
GUI_Text9 dc.b "Vertical Adjustment",0
GUI_Text10 dc.b "Hide",0
GUI_Text11 dc.b "Quit",0
GUI_Choose1.1 dc.b "left",0
GUI_Choose1.2 dc.b "right",0
GUI_Choose1.3 dc.b "center",0
GUI_Choose1.4 dc.b "off",0
GUI_Choose2.1 dc.b "top",0
GUI_Choose2.2 dc.b "bottom",0
GUI_Choose2.3 dc.b "center",0
GUI_Choose2.4 dc.b "off",0
even